package cn.stylefeng.guns.modular.business.neo4j.repository;

import cn.stylefeng.guns.modular.business.neo4j.entity.Dynasty;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.neo4j.repository.query.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import java.util.List;


public interface DynastyRepository  extends Neo4jRepository<Dynasty,Long> {
    List<Dynasty> findAllByTitle(String title);

    List<Dynasty> findAllByTitleLike(String title);
    @Query("MATCH (n:Dynasty) WHERE n.title =~ ('.*'+$title+'.*') RETURN n")
    Dynasty findDynastyTitle(String title);
}
